
#include <gtest/gtest.h>
#include <vtkm/exec/ParametricCoordinates.h>
#include <vtkm/CellTraits.h>

#include "quadrature/Qaudrature.h"
#include "vtkm/testing/Testing.h"

template<typename CellShape>
void print()
{
	std::cout << typeid(CellShape).name() << std::endl;
	auto num_pts = vtkm::CellTraits<CellShape>::NUM_POINTS;
	for (Id i = 0; i < num_pts; i++)
	{
		Vec3f point;
		vtkm::exec::ParametricCoordinatesPoint(num_pts, i, CellShape{}, point);
		std::cout << point << std::endl;
	}
}

TEST(Quadrature, 1D)
{
	using QType = QGauss<vtkm::CELL_SHAPE_LINE, SECOND>;
	EXPECT_EQ(QType::NUM_COMPONENTS, 2);

	auto a = QType::a;
	EXPECT_FLOAT_EQ(QType::points[0][0], a);

	//print<vtkm::CellShapeTagLine>();
	//print<vtkm::CellShapeTagTriangle>();
	//print<vtkm::CellShapeTagQuad>();
	//print<vtkm::CellShapeTagTetra>();
	//print<vtkm::CellShapeTagHexahedron>();
	//print<vtkm::CellShapeTagWedge>();
	//print<vtkm::CellShapeTagPyramid>();

	using QTri = QGauss<vtkm::CELL_SHAPE_TRIANGLE, SECOND>;

	vtkm::VecVariable<Vec3f, 3> wcoords;
	wcoords.Append({ 0.,0.,0 });
	wcoords.Append({ 4,0,0 });
	wcoords.Append({ 0,4,0 });
	Vec3f pcoords = QTri::points[0];
	Vec3f result;
	vtkm::exec::ParametricCoordinatesToWorldCoordinates(wcoords, pcoords, vtkm::CellShapeTagTriangle{}, result);
	std::cout << result << std::endl;

}
